d1 = dict()

statistic_file = input("输入文件路径及文件名:")

with open(statistic_file,encoding='utf8') as f:
    for line in f:
        list1 = line.lower().replace('.',' ').replace(',',' ').replace('?',' ').replace('|',' ').replace(':',' ').replace('(',' ').replace(')',' ').split()
        for word in list1:
            if d1.get(word):
                d1[word] = d1[word] + 1
            else:
                d1[word] = 1

d2 = sorted(d1.items(),key= lambda kv:kv[1],reverse=True)

for i in range(10):
    print(d2[i])


# 效率有点差, 可以改进一下